
import Vue from "vue";
const filters = {};
// 支付类型
/* filters.filterPayType = (value) =>
    ({
        1: "一般意向",
        2: "中度意向",
        3: "高度意向",
    }[value] || "其他"); */

// 过滤手机号
filters.filterIphone = (value) => {
    return value.replace(value.substring(3, 7), "****");
};

// 过滤手机号
filters.filterFileName = (value) => {
    return value.length > 17 ? value.replace(value.substring(8, value.length - 10), "...") : value;
};

filters.getImage= (url) =>{
   // console.log(url);
   // 把现在的图片连接传进来，返回一个不受限制的路径
   if(url !== undefined){
   	return url.replace(/^(http)[s]*(\:\/\/)/,'https://images.weserv.nl/?url=');
   }
}

const mountFilters = (Vue) => {
    for (const i in filters) {
        Vue.filter(i, filters[i]);
    }
};

mountFilters(Vue);